package springx.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springx.mapper.AdminMapper;
import springx.pojo.Admin;
import springx.uitils.Rest;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 夏JCC
 * @since 2022-05-19 16:31:58
 */
@RestController
@RequestMapping("/admin")
public class AdminController {

    @Autowired
    private AdminMapper adminMapper;


    @RequestMapping("/info")
    public Rest<?> admin(){
        String name = "系统管理员";
        QueryWrapper<Admin> wrapper = new QueryWrapper<>();
        wrapper.eq("name",name);
        List<Admin> list = adminMapper.selectList(wrapper);
        if (list.isEmpty()){
            return  Rest.ERROR("没有数据");
        }
        return Rest.SUCCESS("返回数据",list);
    }


}
